#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

using namespace std;

/*
*	求最大重复子串
*	input:   abccdeff
*   output:  4
*/
void Test_maxsubstr_01();




int main(int argc, char *argv[])
{
	std::cout << "hello world" << std::endl;
	
	Test_maxsubstr_01();
	return 0;
}



void Test_maxsubstr_01()
{
	char str[1024] = {0};
	int nlen = 0;
	int flag[128] = {0};
	int ncount = 0, nMaxCount = 0;
	int i;
	int ch;
	
	scanf("%s", str);
	nlen = strlen(str);
	for( i = 0; i < nlen; i++){
		ch = str[i];
		if( flag[ch] > 0){
			if( nMaxCount < ncount){
				nMaxCount = ncount;
			}
			ncount = 0;
			memset(flag, 0x0, sizeof(flag));
		}
		flag[ch] = 1;
		ncount++;
	}
	if(nMaxCount < ncount){
		nMaxCount = ncount;
	}
	printf("%d\n", nMaxCount);
}

